package me.zhengjie.modules.lock.service.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.zelk.smartlock.common.constant.Constant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 请求离线密码响应参数类
 **/
@ApiModel("运营端请求离线密码响应参数类")
@Data
@ToString
@JsonInclude(JsonInclude.Include.ALWAYS)
public class LockDeviceOfflinePwdDTO implements Serializable {

    @ApiModelProperty(value = "密码ID", dataType = "Long")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long pwdId;

    @ApiModelProperty(value = "密码", dataType = "String")
    private String pwd;

    @ApiModelProperty(value = "密码类型，（once:一次性密码，normal:时效密码，forever：永久密码，userdefined：自定义时效密码，clear：清空密码）", dataType = "String")
    private String type;

    @JsonFormat(pattern = Constant.DATA_FORMAT, timezone = Constant.TIME_ZONE)
    @ApiModelProperty(value = "有效期开始时间")
    private LocalDateTime validFrom;

    @JsonFormat(pattern = Constant.DATA_FORMAT, timezone = Constant.TIME_ZONE)
    @ApiModelProperty(value = "有效期结束时间")
    private LocalDateTime validTo;

    @ApiModelProperty(value = "卡钥匙别名", dataType = "String")
    private String alias;

    public LockDeviceOfflinePwdDTO() {
    }

    public LockDeviceOfflinePwdDTO(Long pwdId, String pwd, String type, LocalDateTime validFrom, LocalDateTime validTo, String alias) {
        this.pwdId = pwdId;
        this.pwd = pwd;
        this.type = type;
        this.validFrom = validFrom;
        this.validTo = validTo;
        this.alias = alias;
    }
}
